import { request } from "@umijs/max";;
import { UMS_REQUEST_PREFIX } from "@/utils/config";
import { lineBatchTypes, lineTypes, lineQuoteTypes } from "@/constants/types";

// 线路列表
/**
 * 获取线路列表
 * @returns 
 */
export async function fetchLpsLineList(params: {
  pageNum: number;
  pageSize: number;
}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/line/list`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 获取线路下拉列表
 * @returns 
 */
export async function fetchLpsLineOptions() {
  return request(`${UMS_REQUEST_PREFIX}/lps/line/options`, {
    method: 'POST',
    dataField: 'data'
  });
}
/**
 * 新增线路
 * @param params 
 * @returns 
 */
export async function addLpsLine(params: lineTypes) {
  return request(`${UMS_REQUEST_PREFIX}/lps/line/add`, {
    method: 'POST',
    data: params
  });
}
/**
 * 新增线路
 * @param params 
 * @returns 
 */
export async function updateLpsLine(params: lineTypes) {
  return request(`${UMS_REQUEST_PREFIX}/lps/line/update`, {
    method: 'POST',
    data: params
  });
}
/**
 * 获取线路详情
 * @param params 
 * @returns 
 */
export async function fetchLpsLineDetail(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/line/detail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}

// 船期列表
/**
 * 获取船期列表
 * @returns 
 */
export async function fetchLpsLineBatchList(params: {
  pageNum: number;
  pageSize: number;
}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineBatch/list`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 添加船期
 * @param params 
 * @returns 
 */
export async function addLpsLineBatch(params: lineBatchTypes) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineBatch/add`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 修改船期
 * @param params 
 * @returns 
 */
export async function updateLpsLineBatch(params: lineBatchTypes) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineBatch/update`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 获取船期详情
 * @param params 
 * @returns 
 */
export async function fetchLpsLineBatchDetail(params: {
  pageNum: number;
  pageSize: number;
}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineBatch/detail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}

// 报价
/**
 * 获取报价列表
 * @returns 
 */
export async function fetchLineQuoteList(params: {
  pageNum: number;
  pageSize: number;
}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineQuote/list`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 新增报价
 * @param params 
 * @returns 
 */
export async function addLpsLineQuote(params: lineQuoteTypes) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineQuote/add`, {
    method: 'POST',
    data: params
  });
}
/**
 * 更新报价
 * @param params 
 * @returns 
 */
export async function updateLpsLineQuote(params: lineQuoteTypes) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineQuote/update`, {
    method: 'POST',
    data: params
  });
}
/**
 * 获取报价详情
 * @param params 
 * @returns 
 */
export async function fetchLpsLineQuoteDetail(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineQuote/detail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 上架
 * @param params 
 * @returns 
 */
export async function lpsLineQuoteOnSale(params: {ids: string[]}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineQuote/onSale`, {
    method: 'POST',
    data: params
  });
}
/**
 * 下架
 * @param params 
 * @returns 
 */
export async function lpsLineQuoteOffSale(params: {ids: string[]}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineQuote/offSale`, {
    method: 'POST',
    data: params
  });
}
/**
 * 导入报价
 * @param params 
 * @returns 
 */
export async function lpsLineQuoteImportQuote(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineQuote/importQuote`, {
    method: 'POST',
    data: params
  });
}
/**
 * 快速报价
 * @param params 
 * @returns 
 */
export async function lineQuoteRapidQuote(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineQuote/rapidQuote`, {
    method: 'POST',
    data: params
  });
}
/**
 * 报价tab
 * @param params 
 * @returns 
 */
export async function fetchLineQuotetabNum(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineQuote/tabNum`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}

// 报价
/**
* 标签列表
* @param params 
* @returns 
*/
export async function fetchLpsLineTagList(params: any) {
 return request(`${UMS_REQUEST_PREFIX}/lps/lineTag/list`, {
   method: 'POST',
   data: params,
   dataField: 'data'
 });
}
/**
* 新建标签
* @param params 
* @returns 
*/
export async function lpsLineTagAdd(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineTag/add`, {
    method: 'POST',
    data: params,
  });
 }
 /**
* 标签详情
* @param params 
* @returns 
*/
export async function fetchLpsLineTagDetail(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineTag/detail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
 }
/**
* 标签价格
* @param params 
* @returns 
*/
export async function lpsLineTagPrice(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineTag/tagPrice`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
 }
/**
* 修改标签
* @param params 
* @returns 
*/
export async function lpsLineTagUpdate(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineTag/update`, {
    method: 'POST',
    data: params
  });
 }
/**
* 启用标签
* @param params 
* @returns 
*/
export async function enableLpsLineTag(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineTag/enable`, {
    method: 'POST',
    data: params
  });
 }
 /**
* 禁用标签
* @param params 
* @returns 
*/
export async function disableLpsLineTag(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineTag/disable`, {
    method: 'POST',
    data: params
  });
 }
/**
* 标签排序
* @param params 
* @returns 
*/
export async function lineTagSort(params: {ids: string[]}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineTag/sort`, {
    method: 'POST',
    data: params
  });
 }
 /**
* 标签下拉列表
* @param params 
* @returns 
*/
export async function fetchLpsLineTagOptions(params: {type: string}) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineTag/options`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
 }
 